﻿
@using Newtouch.Infrastructure
@{
    ViewBag.Title = "企业信息获取";
    Layout = "~/Views/Shared/_Index.cshtml";

}
<script src="~/Content/js/index.js"></script>

<form id="form1">
    <div class="panel panel-default" style="margin-bottom:10px;">
        <div class="panel-heading">企业信息获取</div>
        <table class="form">
            <tr style="float:left;">
                <th class="formTitle">企业编码：</th>
                <td class="formValue">
                    <input id="qybm" class="form-control" placeholder="企业编码" />
                </td>
                <th class="formTitle">企业名称：</th>
                <td class="formValue">
                    <input id="qymc" class="form-control" placeholder="企业名称" />
                </td>
                <th class="formTitle">
                    <input type="button" id="btn_search" class="btn btn-md btn-primary" value="查询" />
                </th>
                <td></td>
            </tr>
        </table>
    </div>
    <div id="dv-detail">
        <table id="gridList"></table>
        <div id="gridPager"></div>
    </div>
</form>

<script type="text/javascript">

    $(function () {
        //gridList();
    });

    

    function getPostData() {
        return {
            QYBM: $("#qybm").val() ,
            QYMC: $("#qymc").val() ,
            QYBMCXTJ :'',
        };
    }

    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/PurchaseManage/Purchase/GetGridJsonYY164",
            height: $(window).height() - 200,
            postData: getPostData(),
            colModel: [
                { label: '企业编码', name: 'QYBM', width: 180, align: 'left' },
                { label: '企业名称', name: 'QYMC', width: 220, align: 'left' },
                { label: '企业地址', name: 'QYDZ', width: 300, align: 'left' },
                { label: '联系人', name: 'LXR', width: 120, align: 'left' },
                { label: '联系电话', name: 'LXDH', width: 140, align: 'left' },

            ],
            multiselect: false,
            //pager: "#gridPager",
            //sortname: '',
            viewrecords: true,
            ondblClickRow: function (rowid, iRow, iCol, e) {
                //btn_selectrow(rowid);
            }
        });
        $("#btn_search").click(function () {
            $('#gridList').jqGrid("clearGridData");
            $gridList.jqGrid('setGridParam', {
                postData: getPostData(),
            }).trigger('reloadGrid');
        });
    }

    //获取明细
    $('#btn_search').click(function () {

        if (($("#qybm").val() == '' || $("#qybm").val() == null) && ($("#qymc").val() == '' || $("#qymc").val() == null)) {
            //弹出确认窗口
            $.modalConfirm("是否确认获取全部企业信息?", function (flag) {
                if (flag) {
                    gridList();
                }
                else {
                    return;
                }
            });
        } else {
            gridList();
        }

    });
</script>


